import json


# 密码加密
import hashlib

def get_password(password):
    md5 = hashlib.md5()
    md5.update(password.encode('utf-8'))
    return md5.hexdigest()
import time
def get_nowtime():
    return time.strftime('%Y-%m-%d')

def get_session(name):
    md5 = hashlib.md5()
    # cpu处理时间
    md5.update(str(time.clock()).encode('utf-8'))
    md5.update(name.encode('utf-8'))
    return md5.hexdigest()
# from functools import wraps
# # 登录装饰器
# def laugh_auth(func):
#     from core import src
#     @wraps(func)
#     def inner(*args,**kwargs):
#         if src.admin_dic['name']:
#             res = func(*args,**kwargs)
#             return res
#         else:
#             print('未登录,自动为您跳转到登录页面')
#             src.login()
#             print('已登录成功,请重新选择')
#     return inner
